/**
 * 快捷支付交易
 *
 * @author xiezz
 * @version 1.1.2
 */
package com.pay.sdk.service.ep;

import java.util.Map;

import com.pay.sdk.common.Configure;
import com.pay.sdk.service.IPostService;
import com.pay.sdk.util.MD5Utils;


public class EpPay extends IPostService {

	private static final String SERVICE_NAME = "api.xy.quikpay.pay";
    private static final String SERVICE_VERSION = "2.0";
    private static final String SERVICE_CHARSET = "UTF-8";
    private static final String SERVICE_SIGN_TYPE = "MD5";

    public String exec(Map<String, String> params) {
    	
    	params.put("version", SERVICE_VERSION);
        params.put("charset", SERVICE_CHARSET);
        params.put("sign_type",SERVICE_SIGN_TYPE);
        params.put("service", SERVICE_NAME);
        params.put("merchant_no", Configure.getMerchantNo());

        params.put("order_no",  params.get("order_no"));
        params.put("order_amount",  params.get("order_amount"));
        params.put("cur",  params.get("cur"));
        params.put("order_title",  params.get("order_title"));
        params.put("order_desc",  params.get("order_desc"));
        params.put("order_time",  params.get("order_time"));
        params.put("order_ip",  params.get("order_ip"));
        params.put("card_no",  params.get("card_no"));
        params.put("sub_mrch",  params.get("sub_mrch"));
        params = MD5Utils.signMap(params, SERVICE_SIGN_TYPE, Configure.getKey(), SERVICE_CHARSET);

        return txn(Configure.isDevEnv() ? Configure.PAY_GATEWAY_DEV_API : Configure.PAY_GATEWAY_API, params);
    }
}
